#ifndef __PROJECT_H__
#define __PROJECT_H__

#define MSGPATH "/home/linux/myworks/"

/* 数据统一结构*/
/*登录数据*/
typedef struct{   
    char ID[128];
    char password[7];
    char flags; //成功 1 失败 0
}user_t;

/*查看环境数据*/
typedef struct{
	unsigned int temp;
	unsigned int hume;
	unsigned int lux;
} env_t;

typedef struct{
	char swlight;//照明开关 1开，0关
	char swfan;//风扇，空调 0关，其他是开
	char swmotor;//加湿器马达 1开，0关
}switch_t;

/*设置阈值数据*/
typedef struct{
	unsigned int tempup;
	unsigned int tempdown;
	unsigned int humeup;
	unsigned int humedown;
	unsigned int luxup;
	unsigned int luxdown;
} limitset_t;

typedef struct{
	long msgtype;
	char commd;
	user_t user;
	env_t envdata;
	switch_t switchset;
	limitset_t limitset;
	/*设备是否在线*/
	char deviceonline;
	/*控制设备数据*/
	char devctrl;
} msg_t;

msg_t msg;

#endif